package com.turing.post.report.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

@SuppressWarnings("serial")
@Entity
@Table(name = "IncomeDaySettlement")
@IdClass(IncomeDaySettlement.class)
public class IncomeDaySettlement implements Serializable {

	public IncomeDaySettlement() {
		super();
	}

	/**
	 * 发卡商NO
	 */
	private String issueCompanyNo;
	/**
	 * 商户号
	 */
	private String merchantNo;
	/**
	 * 帐务日期
	 */
	private Date tranDate;
	/**
	 * 销售机构号
	 */
	private String saleBranchNo;
	/**
	 * M收益机构号
	 */
	private BigInteger mIncomeBranchId;
	/**
	 * S收益机构号
	 */
	private BigInteger sIncomeBranchId;
	/**
	 * 合计消费
	 */
	private BigInteger consume = BigInteger.ZERO;
	/**
	 * 消费笔数
	 */
	private BigInteger consumeCount = BigInteger.ZERO;
	/**
	 * 合计充值
	 */
	private BigInteger deposit = BigInteger.ZERO;
	/**
	 * 充值笔数
	 */
	private BigInteger depositCount = BigInteger.ZERO;
	/**
	 * 结算比率
	 */
	private BigInteger settRatio = BigInteger.ZERO;
	/**
	 * S收入
	 */
	private BigInteger sIncome = BigInteger.ZERO;
	/**
	 * M收入
	 */
	private BigInteger mIncome = BigInteger.ZERO;
	/**
	 * S追溯收入
	 */
	private BigInteger sPastIncome = BigInteger.ZERO;
	/**
	 * M追溯收入
	 */
	private BigInteger mPastIncome = BigInteger.ZERO;

	@Id
	@Column(name = "ISSUECOMPANYNO", nullable = false)
	public String getIssueCompanyNo() {
		return issueCompanyNo;
	}

	public void setIssueCompanyNo(String issueCompanyNo) {
		this.issueCompanyNo = issueCompanyNo;
	}

	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Id
	@Column(name = "SALEBRANCHNO", nullable = false)
	public String getSaleBranchNo() {
		return saleBranchNo;
	}

	public void setSaleBranchNo(String saleBranchNo) {
		this.saleBranchNo = saleBranchNo;
	}

	@Column(name = "MINCOMEBRANCHID", nullable = false)
	public BigInteger getMIncomeBranchId() {
		return mIncomeBranchId;
	}

	public void setMIncomeBranchId(BigInteger incomeBranchId) {
		mIncomeBranchId = incomeBranchId;
	}

	@Column(name = "SINCOMEBRANCHID", nullable = false)
	public BigInteger getSIncomeBranchId() {
		return sIncomeBranchId;
	}

	public void setSIncomeBranchId(BigInteger incomeBranchId) {
		sIncomeBranchId = incomeBranchId;
	}

	@Column(name = "CONSUME", nullable = false)
	public BigInteger getConsume() {
		return consume;
	}

	public void setConsume(BigInteger consume) {
		this.consume = consume;
	}

	@Column(name = "CONSUMECOUNT", nullable = false)
	public BigInteger getConsumeCount() {
		return consumeCount;
	}

	public void setConsumeCount(BigInteger consumeCount) {
		this.consumeCount = consumeCount;
	}

	@Column(name = "DEPOSIT", nullable = false)
	public BigInteger getDeposit() {
		return deposit;
	}

	public void setDeposit(BigInteger deposit) {
		this.deposit = deposit;
	}

	@Column(name = "DEPOSITCOUNT", nullable = false)
	public BigInteger getDepositCount() {
		return depositCount;
	}

	public void setDepositCount(BigInteger depositCount) {
		this.depositCount = depositCount;
	}

	@Column(name = "SETTRATIO", nullable = false)
	public BigInteger getSettRatio() {
		return settRatio;
	}

	public void setSettRatio(BigInteger settRatio) {
		this.settRatio = settRatio;
	}

	@Column(name = "SINCOME", nullable = false)
	public BigInteger getSIncome() {
		return sIncome;
	}

	public void setSIncome(BigInteger income) {
		sIncome = income;
	}

	@Column(name = "MINCOME", nullable = false)
	public BigInteger getMIncome() {
		return mIncome;
	}

	public void setMIncome(BigInteger income) {
		mIncome = income;
	}

	@Column(name = "SPASTINCOME", nullable = false)
	public BigInteger getSPastIncome() {
		return sPastIncome;
	}

	public void setSPastIncome(BigInteger pastIncome) {
		sPastIncome = pastIncome;
	}

	@Column(name = "MPASTINCOME", nullable = false)
	public BigInteger getMPastIncome() {
		return mPastIncome;
	}

	public void setMPastIncome(BigInteger pastIncome) {
		mPastIncome = pastIncome;
	}

	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] {
				getIssueCompanyNo(), getMerchantNo(), getTranDate(),
				getSaleBranchNo() });
	}

	@Override
	public boolean equals(Object obj) {
		if ((this == obj))
			return true;
		if ((obj == null))
			return false;
		if (!(obj instanceof IncomeDaySettlement))
			return false;
		IncomeDaySettlement other = (IncomeDaySettlement) obj;

		if (!PCPSUtil.compareObject(this.getIssueCompanyNo(), other
				.getIssueCompanyNo()))
			return false;

		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;

		if (!PCPSUtil.compareObject(this.getTranDate(), other.getTranDate()))
			return false;

		return PCPSUtil.compareObject(this.getSaleBranchNo(), other
				.getSaleBranchNo());
	}
}